/*
求阶乘和
求1！+2！+3！+4！+........+n!的和
 */


import java.util.Scanner;

public class Work3 {
    public static int jiecheng(int n) {
        if(n==1)
            return 1;
        return n * jiecheng(n-1);
    }

    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        for (int i = 1; i <=n ; i++) {
            sum += jiecheng(i);
        }
        System.out.println(sum);
    }
}
